/*************************************************************************
	> File Name: P4305.cpp
	> Author: yufangze
	> Mail: 2224590123@qq.com
	> Created Time: 2025-01-14 10:18:53
 ************************************************************************/

#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <cstdio>
using namespace std;

int main() {
    int t;
    cin >> t;
    while (t--) {
        int n;
        scanf("%d", &n);
        map<int, int> mp;
        for (int i = 0, x; i< n; i++) {
            scanf("%d", &x);
            if (mp[x]) continue;
            printf("%d ", x);
            mp[x] = 1;
        }
        printf("\n");
        mp.clear();
    }
    return 0;
}
